<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
  xmlns:ui="http://java.sun.com/jsf/facelets"
  xmlns:h="http://java.sun.com/jsf/html"
  template="/WEB-INF/template/template.xhtml">

  <ui:define name="page_title">#{msgs['jsf.EditHomePage']}</ui:define>
  <ui:define name="center_content">
    <div class="g--centered">
      <div class="g__item w--1 l--push-bottom-1">
        <h1>#{msgs['jsf.HomepageContent']}</h1>
        <ui:fragment rendered="${not serverConfigurationBean.allowAnonymousUser}">
          <h3 class="txt--danger">#{msgs['jsf.HomepageContent.warning']}</h3>
        </ui:fragment>

        <h:form id="homeContentForm">
          <div class="js-commonmark">
            <h:inputTextarea id="homeContent"
              required="false"
              value="#{serverConfigurationBean.homeContent}"
              styleClass="js-commonmark__editor"/>

            <div class="l--push-top-half">
              <h:commandButton id="update" styleClass="button button--primary l--push-right-quarter"
                value="#{msgs['jsf.Update']}"
                action="#{serverConfigurationBean.updateHomeContent}"/>
              <h:button id="cancel" outcome="/public/home.xhtml" styleClass="button"
                value="#{msgs['jsf.Cancel']}"/>
            </div>

            <hr/>
            <div id="home-content-preview" class="prose prose--preview js-commonmark__preview"></div>

          </div>

          <h:outputScript target="body" library="webjars" name="${webjars.googleCajaHtmlSanitizerJS}"/>
          <h:outputScript target="body" library="webjars" name="${webjars.commonmarkJS}"/>
          <h:outputScript target="body" name="script/commonmark-preview.js"/>
        </h:form>

      </div>
    </div>


  </ui:define>

</ui:composition>
